<%@ page import="com.my.Customer" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<h4>HttpSessionBindingListener</h4>

<%--
    Customer customer = new Customer();
    session.setAttribute("customer", customer);

    System.out.println("------------");
    session.removeAttribute("customer");
--%>

<%
    Object customer = session.getAttribute("customer");

    if (customer == null) {
        customer = new Customer();
        session.setAttribute("customer", customer);
        System.out.println("创建一个新的customer对象" + customer + "，并放入到session中");
    } else {
        System.out.println("从session中读取到customer对象" + customer);
    }
%>

</body>
</html>
